package com.authine.cloudpivot.web.api.dao;

import com.authine.cloudpivot.web.Utils.MyMapper;
import com.authine.cloudpivot.web.api.vo.AtsMapModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Repository
public interface AtsMapper extends MyMapper<AtsMapModel> {

    /**
     * @description: 获取地图数据
     * @method: getIdByAddress
     * @date: 2021/12/13 16:40
     * @author: zyj
     * @param address
     */
    String getIdByAddress(String address);

    /**
     * @description: 反写数据
     * @method: updateDemandDetail
     * @date: 2021/12/22 15:54
     * @author: zyj
     * @param demandDetailId
     * @param idCode
     * @param atsId
     * @return: java.lang.Integer
     */
    Integer updateDemandDetail(@Param("demandDetailId")String demandDetailId, @Param("idCode")String idCode, @Param("atsId")String atsId);

    /**
     * @description: 需要查询的周报
     * @method: getWeeklyReport
     * @date: 2021/12/30 10:21
     * @author: zyj
     * @param now
     * @return: java.util.List<java.lang.String>
     */
    List<String> getWeeklyReport(@Param("now")LocalDateTime now);

    /**
     * @description: 周报反写
     * @method: updateWeeklyReport
     * @date: 2021/12/30 15:41
     * @author: zyj
     * @param updateData
     * @return: java.lang.Integer
     */
    Integer updateWeeklyReport(@Param("map") Map<String, Object> updateData);

    /**
     * @description: 获取店检需求变更子表数据
     * @method: getShopInspectionStores
     * @date: 2022/1/4 14:48
     * @author: zyj
     * @param updateId
     * @return: java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
     */
    List<Map<String, Object>> getShopInspectionUpdateStores(@Param("updateId") String updateId);

    /**
     * @description: 删除店检需求子表
     * @method: deleteShopInspectionStores
     * @date: 2022/1/4 14:55
     * @author: zyj
     * @param id
     * @return: java.lang.Integer
     */
    Integer deleteShopInspectionStores(@Param("id") String id);

    /**
     * @description: 保存店检需求子表数据
     * @method: saveShopInspectionStores
     * @date: 2022/1/4 16:33
     * @author: zyj
     * @param list
     * @return: java.lang.Integer
     */
    Integer saveShopInspectionStores(@Param("list") List<Map<String, Object>> list);

    /**
     * @description: 查询哪些表单用到了关联
     * @method: getCodeByRelativeCode
     * @date: 2022/1/10 13:39
     * @author: zyj
     * @param schemaCode
     * @return: java.util.List<java.lang.String>
     */
    List<Map<String, String>> getCodeByRelativeCode(@Param("schemaCode") String schemaCode);

    /**
     * @description: 查询表单是否关联使用
     * @method: getTableCodeUse
     * @date: 2022/1/10 15:49
     * @author: zyj
     * @param tableNameByCode
     * @param code
     * @param id
     * @return: java.lang.Integer
     */
    Integer getTableCodeUse(@Param("tableName") String tableNameByCode, @Param("code") String code, @Param("id") String id);

    /**
     * @description: 查询表单是否存在
     * @method: getTableExist
     * @date: 2022/1/10 15:49
     * @author: zyj
     * @param code
     * @return: java.lang.Integer
     */
    String getTableExist(@Param("code") String code);

    /**
     * @description: ats调用关闭
     * @method: closeDemandDetail
     * @date: 2022/1/11 16:58
     * @author: zyj
     * @param id
     * @return: java.lang.Integer
     */
    Integer closeDemandDetail(@Param("id") String id);

    /**
     * @description: ats通知完成数
     * @method: addDemandDetail
     * @date: 2022/1/11 17:04
     * @author: zyj
     * @param id
     * @param count
     * @return: java.lang.Integer
     */
    Integer addDemandDetail(@Param("id") String id, @Param("count") Integer count);

    /**
     * @description: 周报汇总--查询修改数据
     * @method: getUpdateWeeklyReport
     * @date: 2021/12/30 15:41
     * @author: zyj
     * @param updateData
     * @return: java.lang.Integer
     */
    String getUpdateWeeklyReport(@Param("map") Map<String, Object> updateData);

    /**
     * @description: 周报汇总--查询修改数据的各项数据总和
     * @method: getUpdateWeeklyReportSum
     * @date: 2022/3/22 4:18
     * @author: zyj
     * @param updates
     * @return: java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
     */
    List<Map<String, Object>> getUpdateWeeklyReportSum(@Param("list") List<String> updates);

    /**
     * @description: 周报汇总--修改汇总表
     * @method: updateWeeklyReportSum
     * @date: 2022/3/22 4:18
     * @author: zyj
     * @param map
     * @return: java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
     */
    Integer updateWeeklyReportSum(@Param("map")Map<String, Object> map);

    /**
     * @description: 保存ats日报
     * @method: saveWeeklyReportDetail
     * @date: 2022/3/31 17:18
     * @author: zyj
     * @param values
     * @return: void
     */
    Integer saveWeeklyReportDetail(@Param("list")List<Map<String, Object>> values);

    /**
     * @description: 查询详情数和完成数
     * @method: getFinishedById
     * @date: 2022/4/27 11:16
     * @author: zyj
     * @param id
     * @return: java.util.Map<java.lang.String, java.lang.Integer>
     */
    Map<String, Integer> getFinishedById(@Param("id")String id);

    /**
     * @description: 根据名字获取用户ID
     * @method: getUserIdByName
     * @date: 2022/4/27 17:28
     * @author: zyj
     * @param name
     * @return: java.lang.String
     */
    String getUserIdByName(@Param("name")String name);

    /**
     * @description: 查找进行中的职位数量
     * @method: findStartCount
     * @date: 2022/4/28 2:39
     * @author: zyj
     * @param parentId
     * @return: java.lang.Integer
     */
    Integer findStartCount(@Param("parentId")String parentId);

    /**
     * @description: 关闭招聘需求
     * @method: closeRecruitmentDemand
     * @date: 2022/4/28 2:43
     * @author: zyj
     * @param parentId
     * @return: void
     */
    void closeRecruitmentDemand(@Param("parentId")String parentId);

    /**
     * @description: 周报全部0初始化
     * @method: updateAll
     * @date: 2022/5/31 15:18
     * @author: zyj
     * @param parse
     * @return: void
     */
    void updateAll(@Param("date")LocalDateTime parse);
}